﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using WuxiWTO.Mapping;
using System.Data.Linq;

namespace WutiWTO.Common
{
    public class UserInfo
    {
        public static bool AllowRegValidate()
        {
            WTODataContext ctx = new WTODataContext();
            site_setting setting = ctx.site_settings.SingleOrDefault<site_setting>(p => p.ID == 1);
            if (setting != null)
            {
                if (setting.allow_reg_validate.HasValue)
                {
                    if (setting.allow_reg_validate.Value == '0')
                    {
                        return false;
                    }
                    else
                    {
                        return true;
                    }
                }
                else
                {
                    return false;
                }
            }
            else
            {
                return false;
            }
        }

        public static bool AllowUserRegister()
        {
            WTODataContext ctx = new WTODataContext();
            site_setting setting = ctx.site_settings.SingleOrDefault<site_setting>(p => p.ID == 1);
            if (setting != null)
            {
                if (setting.allow_register.HasValue)
                {
                    if (setting.allow_register.Value == '0')
                    {
                        return false;
                    }
                    else
                    {
                        return true;
                    }
                }
                else
                {
                    return false;
                }
            }
            else
            {
                return false;
            }
        }
    }
}
